/*******************************************************************************
 * Copyright (c) 2000, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Author:
 *     coolair.loveU2@gmail.com
 *******************************************************************************/

package org.skyfree.ghyll.tcard.core.storage;

import java.net.URI;
import java.util.HashMap;

import org.skyfree.ghyll.tcard.core.ITCard;
import org.skyfree.ghyll.tcard.core.ITProject;
import org.skyfree.ghyll.tcard.core.ITProjectDescription;
import org.skyfree.ghyll.tcard.core.ITWorkpiece;
import org.skyfree.ghyll.tcard.core.ITWorkspace;


/**
 * ITCardStorageProvider define the interface of storage implementation.
 * High level application will not be aware the different solution.
 */

public interface ITCardStorageProvider
{
	/**
	 * Initialize and get ready.
	 */
	void initialize();
	
	/**
	 * Set the provider type.
	 * @param type type of the storage provider.
	 */
	void setType(String type);
	
	/**
	 * Return the type of Provider
	 * @return the type of Provider
	 */
	String getType();

	void load(ITProjectDescription projectDescription) throws Exception;

	void save(ITProjectDescription projectDescription) throws Exception;

	String[] load(ITWorkspace workspace);

	String[] getWorkPiece(ITProject project);

	HashMap<String,String[]> load(ITWorkpiece workpiece) throws Exception;
	
	void save(ITWorkpiece workpiece) throws Exception;
	
	void load(ITCard tcard) throws Exception;
	
	void save(ITCard card) throws Exception;
	
	URI getRootURL();

	void delete(ITCard card) throws Exception;;
	
	void delete(ITWorkpiece workpiece) throws Exception;;
	
	void delete(ITProject project) throws Exception;

	void createRepoCategory(String name)throws Exception;
	
	void deleteRepoCategory(String name)throws Exception;

	String[] getRepoCategorys();
	
	String[] getWorkpiece(String category);

	void move2Progress(ITWorkpiece workpiece) throws Exception;

	ITWorkpiece loadInProgressWorkpiece(ITWorkpiece workpiece) throws Exception;

	boolean createLink(ITProject project, ITWorkpiece next) throws Exception;

	void move2Home(ITWorkpiece workpiece) throws Exception;

	void move2Repository(ITWorkpiece wp, String category) throws Exception;
	
}
